/* 常用正则 */
const commonRegulars = {
  // 手机号
  mobile: /^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\d{8}$/,
  // 分数
  score: /^([1-9]|[1-9][0-9]|100)$/
}

/* 在线客服功能 */
function onlineService() {
  alert('调用了在线客服功能')
}

function resize() {
  var width = document.documentElement.clientWidth
  let rate = 1
  if (width > 750) {
    rate = 1
  } else {
    rate = width / 750
  }
  document.documentElement.style.fontSize = `${rate * 100}px`
}

// 节流
function throttle(callback, time = 100) {
  var timer = null
  return function() {
    if (timer) {
      clearTimeout(timer)
    }
    timer = setTimeout(function() {
      callback()
    }, time)
  }
}

window.onload = () => {
  document.body.style.fontSize = '16px'
  resize()
}
window.onresize = throttle(resize)